import 'package:json_annotation/json_annotation.dart';

import 'item_style.dart';
import 'text_style.dart';

part 'visual_map.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Controller {
  var inRange;
  var outOfRange;

  Controller({this.inRange, this.outOfRange});

  factory Controller.fromJson(Map<String, dynamic> json) =>
      _$ControllerFromJson(json);

  Map<String, dynamic> toJson() => _$ControllerToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class VisualMap {
  var id;

  VisualMap({this.id});

  factory VisualMap.fromJson(Map<String, dynamic> json) =>
      _$VisualMapFromJson(json);

  Map<String, dynamic> toJson() => _$VisualMapToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class ContinuousVisualMap extends VisualMap {
  var type = 'continuous';
  var id;
  var min;
  var max;
  var range;
  var calculable;
  var realtime;
  var inverse;
  var precision;
  var itemWidth;
  var itemHeight;
  var align;
  var text; //['High', 'Low']
  var textGap;
  var show;
  var dimension;
  var seriesIndex;
  var hoverLink;

  var inRange;
  var outOfRange;

  Controller? controller;

  var zlvel;
  var z;
  var left;
  var top;
  var right;
  var bottom;
  var orient;
  var padding;
  var backgroundColor;
  var borderColor;
  var borderWidth;
  var color;
  TextStyle? textStyle;
  var formatter;
  var handleIcon;
  var handleSize;
  ItemStyle? handleStyle;
  var indicatorIcon;
  var indicatorSize;
  ItemStyle? indicatorStyle;

  ContinuousVisualMap(
      {this.id,
      this.min,
      this.max,
      this.range,
      this.calculable,
      this.realtime,
      this.inverse,
      this.precision,
      this.itemWidth,
      this.itemHeight,
      this.align,
      this.text,
      this.textGap,
      this.show,
      this.dimension,
      this.seriesIndex,
      this.hoverLink,
      this.inRange,
      this.outOfRange,
      this.controller,
      this.zlvel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.orient,
      this.padding,
      this.backgroundColor,
      this.borderColor,
      this.borderWidth,
      this.color,
      this.textStyle,
      this.formatter,
      this.handleIcon,
      this.handleSize,
      this.handleStyle,
      this.indicatorIcon,
      this.indicatorSize,
      this.indicatorStyle})
      : super(id: id);

  factory ContinuousVisualMap.fromJson(Map<String, dynamic> json) =>
      _$ContinuousVisualMapFromJson(json);

  Map<String, dynamic> toJson() => _$ContinuousVisualMapToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class PiecewiseVisualMap extends VisualMap {
  var type = 'piecewise';
  var id;
  var splitNumber;
  var pieces;
  var categories;
  var min;
  var max;
  var minOpen;
  var maxOpen;
  var selectedMode;
  var inverse;
  var precision;
  var itemWidth;
  var itemHeight;
  var align;
  var text; //['High', 'Low']
  var textGap;
  var showLabel;
  var itemGap;
  var itemSymbol;

  var show;
  var dimension;
  var seriesIndex;
  var hoverLink;

  var inRange;
  var outOfRange;

  Controller? controller;

  var zlvel;
  var z;
  var left;
  var top;
  var right;
  var bottom;
  var orient;
  var padding;
  var backgroundColor;
  var borderColor;
  var borderWidth;
  var color;
  TextStyle? textStyle;
  var formatter;

  PiecewiseVisualMap(
      {this.id,
      this.splitNumber,
      this.pieces,
      this.categories,
      this.min,
      this.max,
      this.minOpen,
      this.maxOpen,
      this.selectedMode,
      this.inverse,
      this.precision,
      this.itemWidth,
      this.itemHeight,
      this.align,
      this.text,
      this.textGap,
      this.showLabel,
      this.itemGap,
      this.itemSymbol,
      this.show,
      this.dimension,
      this.seriesIndex,
      this.hoverLink,
      this.inRange,
      this.outOfRange,
      this.controller,
      this.zlvel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.orient,
      this.padding,
      this.backgroundColor,
      this.borderColor,
      this.borderWidth,
      this.color,
      this.textStyle,
      this.formatter})
      : super(id: id);

  factory PiecewiseVisualMap.fromJson(Map<String, dynamic> json) =>
      _$PiecewiseVisualMapFromJson(json);

  Map<String, dynamic> toJson() => _$PiecewiseVisualMapToJson(this);
}
